Imports System.Xml.Serialization
Namespace Mapping

    <System.Serializable(), _
     System.ComponentModel.DesignerCategory("code"), _
     System.Xml.Serialization.XmlType([Namespace]:=CSXmlNamespace)> _
    Public Class EntityTypeModificationFunctionMapping
        Inherits XEntityModelElementBase

        ''' <summary>Initializes an instance of the <see cref="EntityTypeModificationFunctionMapping" /> class.
        ''' This is the default constructor for this class.</summary>
        Public Sub New()
            MyBase.New("ModificationFunctionMapping", CSXmlNamespace)
        End Sub

        ''' <summary>Initializes an instance of the <see cref="EntityTypeModificationFunctionMapping" /> class.</summary>
        ''' <param name="other">An <see cref="System.Xml.Linq.XElement"/> object to copy from.</param>
        Public Sub New(ByVal other As XElement)
            MyBase.New(other)
        End Sub

        <AutoLoad()> _
        <XmlElement("DeleteFunction")> _
        Public Property DeleteFunction() As EntityTypeModificationFunction
            Get
                Return DirectCast(Me.Element(MyBase.Name.Namespace + "DeleteFunction"), EdmxEditor.Mapping.EntityTypeModificationFunction)
            End Get
            Set(ByVal value As EntityTypeModificationFunction)
                If (DirectCast(value, XElement).Name <> (MyBase.Name.Namespace + "DeleteFunction")) Then
                    Throw New ArgumentException("Invalid Element")
                End If
                If (Me.DeleteFunction IsNot Nothing) Then
                    Me.DeleteFunction.Remove()
                End If
                Me.Add(New EdmxEditor.Mapping.EntityTypeModificationFunction(value))
            End Set
        End Property

        <AutoLoad()> _
        <XmlElement("InsertFunction")> _
        Public Property InsertFunction() As EntityTypeModificationFunctionWithResult
            Get
                Return DirectCast(Me.Element(MyBase.Name.Namespace + "InsertFunction"), EdmxEditor.Mapping.EntityTypeModificationFunctionWithResult)
            End Get
            Set(ByVal value As EntityTypeModificationFunctionWithResult)
                If (DirectCast(value, XElement).Name <> (MyBase.Name.Namespace + "InsertFunction")) Then
                    Throw New ArgumentException("Invalid Element")
                End If
                If (Me.InsertFunction IsNot Nothing) Then
                    Me.InsertFunction.Remove()
                End If
                Me.Add(New EdmxEditor.Mapping.EntityTypeModificationFunctionWithResult(value))
            End Set
        End Property

        <AutoLoad()> _
        <XmlElement("UpdateFunction")> _
        Public Property UpdateFunction() As EntityTypeModificationFunctionWithResult
            Get
                Return DirectCast(Me.Element(MyBase.Name.Namespace + "UpdateFunction"), EdmxEditor.Mapping.EntityTypeModificationFunctionWithResult)
            End Get
            Set(ByVal value As EntityTypeModificationFunctionWithResult)
                If (DirectCast(value, XElement).Name <> (MyBase.Name.Namespace + "UpdateFunction")) Then
                    Throw New ArgumentException("Invalid Element")
                End If
                If (Me.UpdateFunction IsNot Nothing) Then
                    Me.UpdateFunction.Remove()
                End If
                Me.Add(New EdmxEditor.Mapping.EntityTypeModificationFunctionWithResult(value))
            End Set
        End Property

    End Class

End Namespace